﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DPortAck.ObjectModel
{
    public class ConnectionTestResult : TestResult
    {
        private ConnectionTest _test;
        private List<MachineConnectionTestResult> _machineTestsResults;

        public ConnectionTest Test
        {
            get { return _test; }
        }

        public ConnectionTestResult(ConnectionTest test)
        {
            if (test == null)
                throw new ArgumentNullException("test");

            _test = test;
        }

        public void AddTestResult(MachineConnectionTestResult machineTestResult)
        {
            if (machineTestResult == null)
                throw new ArgumentNullException("machineTestResult");

            if (_machineTestsResults == null)
                _machineTestsResults = new List<MachineConnectionTestResult>();

            _machineTestsResults.Add(machineTestResult);
        }
        
        public MachineConnectionTestResult[] GetResults()
        {
            return (_machineTestsResults != null) ? _machineTestsResults.ToArray() : null;
        }
    }
}
